<?php
/**
 * PHP Framework Commerce Core Session controller
 *
 * @author Andrew <andrew@vitche.com>
 * @author Frozen Rain <frozenrain@mail.ru>
 **/

class Session extends Entity {

    private $_token = null;

    public function __construct() {

        $this->_token = Configuration::get('Framework.CommerceCore.Authentication.Session._token');
    }

    public function getToken() {

        return $this->_token;
    }

    public static function start($login, $password) {

        $Session = new Session();
        $LogOnReference = new LogOnReference();
        $Session->_token = $LogOnReference->process($Session->_token, $login, $password);
        $Session->saveToSession();
        return $Session;
    }
}
?>